import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;

public class MyListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //这里就可以获取到初始化的参数了
        System.out.println("ServletContextListener init:"+sce.getServletContext().getInitParameter("param1"));
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("ServletContextListener destroy");
    }
}
